import os, os.path;

# fiilelist
cpp_list = Split("""
	bs_cube.cpp
	bs_cube_t.cpp
	main.cpp
""");

# directories
lib_name = 'bs_cube';
tar_name = lib_name;
kernel_lib = 'blue_sky';

# import custom settings
Import('*');

# construct base environ
base_env = custom_env.Clone();
base_env.AppendUnique(
	CPPDEFINES = ['BS_EXPORTING_PLUGIN'],
	CPPPATH = ['src', '#kernel/include']
);

# check if we are building with python support
if base_env['py'] == '1' :
	base_env.AppendUnique(
		CPPDEFINES = ['BSPY_EXPORTING_PLUGIN'],
		CPPPATH = ['#kernel/include/python']
	);

if build_kind == 'debug' :
	lib_name += '_d';
	kernel_lib += '_d';
base_env.Append(LIBS = kernel_lib);

# actually build target
bs_cube = base_env.SharedLibrary(target = os.path.join(tar_exe_plugin_dir, lib_name), source = [os.path.join('src', x) for x in cpp_list]);
# specify dependencies or ignore them
if base_env['deps'] == 'off' :
	Ignore(bs_cube, bs_kernel);
elif base_env['deps'] == 'explicit' :
	Depends(bs_cube, bs_kernel);

#	bs_cube_debug = debug_env.Install(exe_dir_dbg, debug);
base_env.Alias(tar_name, bs_cube);
Export('bs_cube');

# 	Install step
if base_env['install'] == '1':
	inst_tar = base_env.Install('$plugins_prefix', bs_cube);
	Alias(tar_name, inst_tar);

